package com.esri.core.tasks.ags.geoprocessing;

import com.esri.core.internal.util.d;
import com.esri.core.io.EsriServiceException;
import com.tencent.smtt.sdk.TbsVideoCacheTask;
import java.net.URL;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.map.annotate.JsonSerialize;

@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
/* loaded from: classes.dex */
public class GPRasterDataLayer extends GPParameter {
    private static final long serialVersionUID = 1;
    private GPRasterData gpRasterData;
    private GPMapImage mapImage;

    public GPRasterDataLayer(String str) {
        this.mapImage = null;
        this.gpRasterData = null;
        setParamName(str);
        this.dataType = "GPRasterDataLayer";
    }

    public GPRasterDataLayer() {
        this("");
    }

    @JsonIgnore
    public void setRasterDataUrl(String str) {
        if (this.gpRasterData == null) {
            this.gpRasterData = new GPRasterData(getParamName());
        }
        this.gpRasterData.setUrl(str);
    }

    @JsonIgnore
    public void setFormat(String str) {
        if (this.gpRasterData == null) {
            this.gpRasterData = new GPRasterData(getParamName());
        }
        this.gpRasterData.setFormat(str);
    }

    @JsonIgnore
    public URL getRasterDataUrl() {
        GPRasterData gPRasterData = this.gpRasterData;
        if (gPRasterData == null) {
            return null;
        }
        return gPRasterData.getUrl();
    }

    @JsonIgnore
    public String getFormat() {
        GPRasterData gPRasterData = this.gpRasterData;
        if (gPRasterData == null) {
            return null;
        }
        return gPRasterData.getFormat();
    }

    public void setMapImage(GPMapImage gPMapImage) {
        this.mapImage = gPMapImage;
    }

    public GPMapImage getMapImage() {
        return this.mapImage;
    }

    @Override // com.esri.core.tasks.ags.geoprocessing.GPParameter
    public String generateValueParams() throws Exception {
        GPRasterData gPRasterData = this.gpRasterData;
        if (gPRasterData != null) {
            return d.a(gPRasterData);
        }
        return d.a(this);
    }

    @Override // com.esri.core.tasks.ags.geoprocessing.GPParameter
    public void fromJson(JsonParser jsonParser) throws Exception {
        if (!d.c(jsonParser)) {
            throw new EsriServiceException("Unable to parse the Response for this GPRasterDataLayer.");
        }
        while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
            String currentName = jsonParser.getCurrentName();
            jsonParser.nextToken();
            if ("mapImage".equals(currentName)) {
                if (this.mapImage == null) {
                    this.mapImage = new GPMapImage();
                }
                this.mapImage.fromJson(jsonParser);
            } else if (TbsVideoCacheTask.KEY_VIDEO_CACHE_PARAM_URL.equals(currentName)) {
                if (this.gpRasterData == null) {
                    this.gpRasterData = new GPRasterData(getParamName());
                }
                this.gpRasterData.setUrl(jsonParser.getText());
            } else if ("format".equals(currentName)) {
                if (this.gpRasterData == null) {
                    this.gpRasterData = new GPRasterData(getParamName());
                }
                this.gpRasterData.setFormat(jsonParser.getText());
            } else {
                jsonParser.skipChildren();
            }
        }
    }

    public int hashCode() {
        GPRasterData gPRasterData = this.gpRasterData;
        int hashCode = ((gPRasterData == null ? 0 : gPRasterData.hashCode()) + 31) * 31;
        GPMapImage gPMapImage = this.mapImage;
        return hashCode + (gPMapImage != null ? gPMapImage.hashCode() : 0);
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj != null && getClass() == obj.getClass()) {
            GPRasterDataLayer gPRasterDataLayer = (GPRasterDataLayer) obj;
            GPRasterData gPRasterData = this.gpRasterData;
            if (gPRasterData == null) {
                if (gPRasterDataLayer.gpRasterData != null) {
                    return false;
                }
            } else if (!gPRasterData.equals(gPRasterDataLayer.gpRasterData)) {
                return false;
            }
            GPMapImage gPMapImage = this.mapImage;
            if (gPMapImage == null) {
                if (gPRasterDataLayer.mapImage != null) {
                    return false;
                }
            } else if (!gPMapImage.equals(gPRasterDataLayer.mapImage)) {
                return false;
            }
            return true;
        }
        return false;
    }
}
